<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UFTGuest.aspx.cs" Inherits="UFTGuest"
    MasterPageFile="~/Default.master" EnableViewState="false" %>

<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.2.Export, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView.Export" TagPrefix="dxwgv" %>
<%@ Register Assembly="DevExpress.Web.v9.2, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dxcb" %>
<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.9.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>
    
<asp:Content ContentPlaceHolderID="head" ID="hd" runat="server" EnableViewState="false">

    <script src="UFTGuest.js" type="text/javascript"></script>
    <script src="js/LOV.js" type="text/javascript"></script>

    <script src="js/Ajax.js" type="text/javascript"></script>

    <%--<script src="js/FileUpload.js" type="text/javascript"></script>

    <script src="js/Datetimepicker.js" type="text/javascript"></script>
    <!-- TinyMCE -->

    <script src="js/tiny_mce.js" type="text/javascript"></script>

    <!-- /TinyMCE -->--%>
    <link href="UFTGuest.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ContentPlaceHolderID="leftMenu" ID="leftnav" runat="server" EnableViewState="false">
<% Response.Write(GenerateSideMenu()); %>

</asp:Content>
<asp:Content ContentPlaceHolderID="content" ID="ctnUFTGuest" runat="server"
    EnableViewState="false">
    <div id="pnlUFTGuestTitle">
    </div>
    <div id="pnl_UFTGuest" runat="server">
            </div>
     <fieldset class="m_fs_border" id="fs_UFTNew">
        <legend>
            <a class="lnk" href="javascript:toggle('UFTNew');">
                Event Details</a>
        </legend>
        <dl class="m_fs">
            <div id="div_UFTNew">
            <% 
            if (m_iEventId > 0)
            {
                Response.Write(m_uftData.BuildFieldSet_UFTData());
            }
            %>
            </div>
        </dl> 
        </fieldset>
        
        <% if ((ICPUser.IsAdmin || ICPUser.IsAdminForum) && iCheckSubmit <= 0)
       {%>
    <fieldset class="m_fs_border" id="fs_Invitation">
        <legend>
            <a class="lnk" href="javascript:toggle('Invitation');">
                Add Customer to Invite</a>
        </legend>
        <dl class="m_fs">
        <%
            Response.Write(UFTManager.BuildUFTCustomer_Filter());
        %>
        <%--<dxcb:ASPxCallback ID="cbkInvitation" ClientInstanceName="cbkInvitation_c" runat="server"
            OnCallback="cbkInvitation_Callback">
            <ClientSideEvents CallbackComplete="function(s, e) { cbkInvitation_c_CallbackComplete(e); }" CallbackError="function(s, e) { cbkInvitation_c_CallbackError(e); }"/>
        </dxcb:ASPxCallback>--%>
        
        <div id="div_Invitation" style="display:block; overflow:visible;">
            <div id="lnkCheckAll2" class="lnk" onclick="checkAll2();" style="float:left;margin-left: 5px;">check</div>
                &nbsp;
            <div id="lnkUncheckAll2" class="lnk" onclick="uncheckAll2();" style="float:left;margin-left: 5px;">uncheck</div>
            <dxwgv:ASPxGridView ID="dgCustomerList" KeyFieldName="CUSTOMER_ID" 
            ClientInstanceName="dgGuest_Invitation_c" runat="server"
            AutoGenerateColumns="true" Width="100%" Font-Size="Small" 
                OnCustomCallback="dgGuest_Invitation_CustomCallback">
            <Styles AlternatingRow-Enabled="True" Cell-Wrap="true" Cell-Font-Size="Smaller" Header-Wrap="true" Header-Font-Size="Smaller" Header-Font-Bold="true">
            <Header Wrap="True" Font-Size="Smaller" Font-Bold="True"></Header>
            <AlternatingRow Enabled="True"></AlternatingRow>
            <Cell Wrap="True" Font-Size="Smaller"></Cell>
                </Styles>
            <SettingsPager PageSize="10"></SettingsPager>
            <Settings ShowFilterBar="Visible" ShowFilterRow="true" ShowFilterRowMenu="true" ShowHorizontalScrollBar="true"  />
            <SettingsBehavior AllowSort="true"/>
            <ClientSideEvents EndCallback="dgGuest_Invitation_c_EndCallBack" />
            </dxwgv:ASPxGridView>
            <br />
            <input type="button" id="btnSelect" class="btn" onclick="DoSelect();" value="Move Selected &darr;&darr;"/>
            <input type="hidden" id="hfSelect"/>
            <br />
            <br />
            
            <%--<p>SELECTED COMPANY</p>
            <dxwgv:ASPxGridView ID="dgSelected" ClientInstanceName="dgSelected_Invitation_c"
                AutoGenerateColumns="true" Width="100%" runat="server" Font-Size="Small" 
                OnCustomCallback="dgSelected_Invitation_CustomCallback" >
                <Styles AlternatingRow-Enabled="True" Cell-Wrap="True" Cell-Font-Size="Smaller"  Header-Wrap="true" Header-Font-Size="Smaller" Header-Font-Bold="true">
                <Header Wrap="True" Font-Size="Smaller" Font-Bold="True"></Header>
                <AlternatingRow Enabled="True"></AlternatingRow>
                <Cell Wrap="True" Font-Size="Smaller"></Cell>
                </Styles>
                <SettingsPager PageSize="10"></SettingsPager>
                <Settings ShowFilterBar="Visible"  ShowHorizontalScrollBar="true"  />
                <SettingsBehavior AllowSort="true"/>
            </dxwgv:ASPxGridView>
        
                    <br/>
                    <input type="button" id="btnSubmit2" class="btn" style="float: left; margin-left: 5px;"
                    onclick="DoSubmit2();" value="Submit" />
                    <div id="loadSubmit2" style="float: left; padding-right: 10px;">
                    </div>--%>
                    
        </div>
        </dl>
    </fieldset>
    <% } %>
        
        
              
    <fieldset class="m_fs_border" id="fs_UFTGuest">
        <legend>
            <a class="lnk" href="javascript:toggle('UFTGuest');">
                Choose Guest</a>
        </legend>
        <dl class="m_fs">
               <div id="div_UFTGuest">
               <dxwgv:ASPxGridView ID="dgGuestList" KeyFieldName="T_RELATION_INVITATION_ID" 
                    ClientInstanceName="dgGuestList_c" runat="server"
                    AutoGenerateColumns="true" Width="100%" Font-Size="Small" 
                    OnCustomCallback="dgGuestList_CustomCallback">
                    <ClientSideEvents EndCallback="function(s, e) { dgGuestList_c_CallbackComplete(e); }" />
                    <Styles Header-HorizontalAlign="Center" AlternatingRow-Enabled="True" Cell-Wrap="true" Cell-Font-Size="Smaller" Header-Wrap="true" Header-Font-Size="Smaller" Header-Font-Bold="true">
                    <Header Wrap="True" Font-Size="Smaller" Font-Bold="True"></Header>
                    <AlternatingRow Enabled="True"></AlternatingRow>
                    <Cell Wrap="True" Font-Size="Smaller"></Cell>
                    </Styles>
                    <SettingsPager PageSize="25"></SettingsPager>
                    <Settings ShowFilterBar="Visible" ShowFilterRow="true" ShowFilterRowMenu="true" />
                    <SettingsBehavior AllowSort="true"/>
                    <%--<Templates >
                        <EditForm>
                        Isi Alasan Reject: <input type="text" ID="reasonEditor" value='<%# Eval("ALASAN_REJECT")%>' />
                        <input type="button" class="btn" ID="btnRE" value='Reject' onclick="DoReject('<%# Eval("T_RELATION_INVITATION_ID")%>');" />
                        <dxwgv:ASPxGridViewTemplateReplacement ID="CancelButton" ReplacementType="EditFormCancelButton"
                                    runat="server" >
                                </dxwgv:ASPxGridViewTemplateReplacement>
                        </EditForm>
                    </Templates>--%>
                    <Columns>
                    <%--<dxwgv:GridViewCommandColumn Name="REJECT" EditButton-Visible="true" EditButton-Text="Reject" />--%>
                    <dxwgv:GridViewCommandColumn ShowSelectCheckbox="true" Width="50px" Caption="Send Email">
                    </dxwgv:GridViewCommandColumn>
					<dxwgv:GridViewDataTextColumn Name="REJECT"
                     Caption="#" Width="50px">
                        <DataItemTemplate>
                            <%# GetRejectColumn(Eval("CUSTOMER_ID").ToString(),Eval("T_RELATION_INVITATION_ID").ToString(),Eval("STATUS_REJECT").ToString())%>
                            <%--<a href="javascript:RejectGuest('<%# Eval("T_RELATION_INVITATION_ID").ToString() %>');">REJECT</a>--%>
                        </DataItemTemplate>
                        <EditFormSettings Visible="False"/>
                    </dxwgv:GridViewDataTextColumn> 
                    <%--<dxwgv:GridViewCommandColumn Caption="#" Width="25px" ShowSelectCheckbox="true" /> --%>
                    <dxwgv:GridViewDataTextColumn FieldName="CUSTOMER_ID" Name="CUSTOMER_ID" Caption="CUSTOMER ID">
                        <EditFormSettings Visible="False" />
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn FieldName="COMPANY_NAME" Name="COMPANY_NAME" Caption="COMPANY NAME" >
                        <DataItemTemplate>
                        <%# GridColumnManager.GetCompanyLinkColumn(Eval("CUSTOMER_ID").ToString(), Eval("COMPANY_NAME").ToString())%>
                        </DataItemTemplate>
                        <EditFormSettings Visible="False" />
                    </dxwgv:GridViewDataTextColumn>
					<dxwgv:GridViewDataTextColumn FieldName="CAR" Name="CAR" Caption="CAR" Width="50px" >
                        <EditFormSettings Visible="False" />
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn FieldName="SEGMEN" Name="SEGMEN" Caption="SEGMEN" Width="50px" >
                        <EditFormSettings Visible="False" />
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn FieldName="SUB_SEGMEN" Name="SUB_SEGMEN" Caption="SUB SEGMEN" Width="50px" >
                        <EditFormSettings Visible="False" />
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn FieldName="KELAS" Name="KELAS" Caption="KELAS" Width="50px" >
                        <EditFormSettings Visible="False" />
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn FieldName="TOTAL_GUEST" Name="TOTAL_GUEST" Caption="TOTAL GUEST" Width="50px" >
                        <EditFormSettings Visible="False" />
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn FieldName="T_RELATION_INVITATION_ID" Name="T_RELATION_INVITATION_ID" Caption="INVITE">
                        <DataItemTemplate>
                            <%# GetInviteColumn(Eval("T_RELATION_INVITATION_ID").ToString(), Eval("CUSTOMER_ID").ToString(), Eval("STATUS_REJECT").ToString())%>
                            <%--<a href="javascript:InviteGuest('<%# Eval("T_RELATION_INVITATION_ID").ToString() %>','<%# Eval("CUSTOMER_ID").ToString() %>');">Invite</a>--%>
                        </DataItemTemplate>
                        <EditFormSettings Visible="False"/>
                    </dxwgv:GridViewDataTextColumn>
                    <dxwgv:GridViewDataTextColumn FieldName="ALASAN_REJECT" Name="ALASAN_REJECT" Caption="ALASAN REJECT">
                        <%--<EditFormSettings Caption="Isi Alasan Reject: " VisibleIndex="0" />--%>
                        <EditFormSettings Visible="False"/>
                    </dxwgv:GridViewDataTextColumn>                     
                    </Columns> 
                    </dxwgv:ASPxGridView>
                    <% if (iCheckSubmit == 0 && (ICPUser.IsAdmin || ICPUser.IsAdminForum))
                       {%>
                       <dxwgv:ASPxGridViewExporter ID="dgExporter" GridViewID="dgGuestList" runat="server">
                        </dxwgv:ASPxGridViewExporter>
                        <dxe:ASPxButton ID="btnExport" runat="server" Text="Save To XLS" UseSubmitBehavior="false"
                            OnClick="btnExport_Click" ClientInstanceName="btnExport_c" Image-Url="images/excel.png" 
                            Width="120px" Height="20px" HorizontalAlign="Left">
                        </dxe:ASPxButton>
                        <input type = "button" id="btnSendEmail" class="btn" onclick="SubmitChooseEmail();" value="Send Email" />
                        <input type = "button" id="btnSubmit" class="btn" onclick="NotSend();" value="Submit" />
                        <div id="load" style="float: left; padding-right: 10px;"></div>
                       <% } %>
                    <input type="hidden" id="hfDisplay" />
                    <br />
                    <br />
               </div> 
        </dl>
    </fieldset>
    <dxcb:ASPxCallback ID="cbkInvite" ClientInstanceName="cbkInvite_c" runat="server" OnCallback="cbkInvite_Callback">
        <ClientSideEvents CallbackComplete="function(s, e) { cbkInvite_c_CallbackComplete(e); }" />
    </dxcb:ASPxCallback>
    
    <div id="popupGuest" class="m_popuplayer">
        <div id="pop" class="popLOV2">
            <div id="lnkUncheckAll" class="lnk" onclick="uncheckAll();" style="float:right;margin-left: 5px;">uncheck</div>
            &nbsp;
            <div id="lnkCheckAll" class="lnk" onclick="checkAll();" style="float:right;margin-left: 5px;">check</div>
            <input type="hidden" id="hfCompID" />
            <input type="hidden" id="hfInvID" />
            Contact Person List
                <dxwgv:ASPxGridView ID="dgGuest" KeyFieldName="ID" 
                        ClientInstanceName="dgGuest_c" runat="server"
                        AutoGenerateColumns="true" Width="100%" Font-Size="Small" 
                        OnCustomCallback="dgGuest_CustomCallback">
                        <Styles Cell-HorizontalAlign="Left" Header-HorizontalAlign="Center" AlternatingRow-Enabled="True" Cell-Wrap="true" Cell-Font-Size="Smaller" Header-Wrap="true" Header-Font-Size="Smaller" Header-Font-Bold="true">
                        <Header Wrap="True" Font-Size="Smaller" Font-Bold="True"></Header>
                        <AlternatingRow Enabled="True"></AlternatingRow>
                        <Cell Wrap="True" Font-Size="Smaller"></Cell>
                        </Styles>
                        <SettingsPager PageSize="5"></SettingsPager>
                        <Settings ShowFilterBar="Visible" ShowFilterRow="true" ShowFilterRowMenu="true" />
                        <SettingsBehavior AllowSort="true"/>
                        <Columns>
                        <dxwgv:GridViewCommandColumn Caption="UNDANG" ShowSelectCheckbox="true" Width="25"/>
                        <dxwgv:GridViewDataTextColumn FieldName="ID" Name="ID" Visible="false"/>
                        <dxwgv:GridViewDataTextColumn FieldName="ID_COMBINED" Name="ID_COMBINED" Visible="false"/>
                        <dxwgv:GridViewDataTextColumn FieldName="NAME" Name="NAME" Caption="NAME" />
                        <dxwgv:GridViewDataTextColumn FieldName="GENDER" Name="GENDER" Caption="GENDER" />
                        <dxwgv:GridViewDataTextColumn FieldName="EMAIL" Name="EMAIL" Caption="EMAIL" />
                        <dxwgv:GridViewDataTextColumn FieldName="PHONE" Name="PHONE" Caption="PHONE" />
                        <dxwgv:GridViewDataTextColumn FieldName="CELLPHONE" Name="CELLPHONE" Caption="CELLPHONE" />
                        <dxwgv:GridViewDataTextColumn FieldName="POSITION" Name="POSITION" Caption="POSITION" />
                        </Columns>
                        <ClientSideEvents EndCallback="function(s, e) { dgGuest_c_CallbackComplete(); }" />
                </dxwgv:ASPxGridView>
                <input type="button" id="btnSelect" class="btn" value="select" onclick="DoSelectGuest();" 
                    style="float: right; margin-left: 5px;" /> 
                    Selected Guest
                <dxwgv:ASPxGridView ID="dgGuestSelected" KeyFieldName="ID" 
                            ClientInstanceName="dgGuestSelected_c" runat="server"
                            AutoGenerateColumns="true" Width="100%" Font-Size="Small" 
                            OnCustomCallback="dgGuestSelected_CustomCallback">
                            <Styles Cell-HorizontalAlign="Left" Header-HorizontalAlign="Center" AlternatingRow-Enabled="True" Cell-Wrap="true" Cell-Font-Size="Smaller" Header-Wrap="true" Header-Font-Size="Smaller" Header-Font-Bold="true">
                            <Header Wrap="True" Font-Size="Smaller" Font-Bold="True"></Header>
                            <AlternatingRow Enabled="True"></AlternatingRow>
                            <Cell Wrap="True" Font-Size="Smaller"></Cell>
                            </Styles>
                            <SettingsPager PageSize="5"></SettingsPager>
                            <Settings ShowFilterBar="Visible" ShowFilterRow="true" ShowFilterRowMenu="true" />
                            <SettingsBehavior AllowSort="true"/>
                            <Columns>
                            <dxwgv:GridViewDataTextColumn FieldName="ID" Name="ID" Visible="false"/>
                            <dxwgv:GridViewDataTextColumn FieldName="ID_COMBINED" Name="ID_COMBINED" Visible="false"/>
                            <dxwgv:GridViewDataTextColumn FieldName="NAME" Name="NAME" Caption="NAME" />
                            <dxwgv:GridViewDataTextColumn FieldName="GENDER" Name="GENDER" Caption="GENDER" />
                            <dxwgv:GridViewDataTextColumn FieldName="EMAIL" Name="EMAIL" Caption="EMAIL" />
                            <dxwgv:GridViewDataTextColumn FieldName="PHONE" Name="PHONE" Caption="PHONE" />
                            <dxwgv:GridViewDataTextColumn FieldName="CELLPHONE" Name="CELLPHONE" Caption="CELLPHONE" />
                            <dxwgv:GridViewDataTextColumn FieldName="POSITION" Name="POSITION" Caption="POSITION" />
                            </Columns>
                            <ClientSideEvents EndCallback="function(s, e) { dgGuestSelected_c_CallbackComplete(); }" />
                    </dxwgv:ASPxGridView>
                <input type="button" id="btnCancel" class="btn" value="close" onclick="DoCancelGuest();" 
                    style="float: right; margin-left: 5px;" />  
                <%--<input type="button" id="btnSave" class="btn" value="save" onclick="DoSaveGuest();" 
                    style="float: right; margin-left: 5px;" /> --%> 
        </div>
    </div>
</asp:Content>
